﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace BigData
{
    static class BigDataHandle
    {
        public static TextState GetTextState(string txt)
        {
            if (Regex.Match(txt, "^\\w[\\w\\._]+@\\w+\\.com-{4}[^\\-\\|\\s]+$").Success) return TextState.Normal;
            if (Regex.Match(txt, "^\\w[\\w\\._]+@\\w+\\.com\\s+[^\\-\\|\\s]+$").Success) return TextState.NoSeparator;
            return TextState.Unnormal;
        }

        public static string GetMailDomain(string txt)
        {
            Match m = Regex.Match(txt, "@(.*?)\\.com");
            if (m.Success) return m.Groups[1].Value;
            return null;
        }

        public enum TextState
        {
            Normal,
            Unnormal,
            NoSeparator,
        }
    }
}
